//
//  MAEnvModel.swift
//  Mall-swift
//
//  Created by Bob on 2020/10/19.
//  Copyright © 2020 Bob. All rights reserved.
//

import UIKit
import HandyJSON

public struct MAEnvModel: HandyJSON {
    public init() {
        
    }
    var kPutbucketName:String = ""
    public var kImgbaseUrl: String = ""
    var MADebugRequestBaseURL: String = ""
    /// 用户协议地址
    var MAUserAgreementURL: String = ""
    // 隐私政策的地址
    var MAUserPrivacyURL: String = ""
    /// 交易所签约说明 同步安卓的生产地址
    var MATradeAgreementURL: String = ""
    /// 成为领主
    var MAUserPlaceURL: String = ""
    var NACelebritySettlementAgreement: String = ""
    /// 奖励金攻略
    var k_rewardsGuideUrl: String = ""
    /// 购票
    var k_ticketUrl: String = ""
    /// 资讯详情H5
    var k_infoH5Url: String = ""
    /// 我的 邀请好友
    var k_mineInviteUrl: String = ""
}
private func loadEnv() -> MAEnvModel?{
   
    guard  let dict: [String: [String:[String:String]]] = PlistLoader.loadPlist(name: "AppEnvironment"),
//        let dict = PlistLoader.loadPlist(name: "AppEnvironment") as? [String: [String:[String:String]]],
          let envDic = dict["serverAddress"],
          let proDic = envDic["production"],
          let devDic = envDic["develop"] else {
        return nil
    }
//    #if DEBUG
//    let desDic = (Defaults.TSPlusServerTypeKey == 2) ? proDic : devDic
//    #else
    let desDic = proDic
//    #endif
    return MAEnvModel.deserialize(from: desDic)
}
open  class MAEnvMgr {
    public static let share = MAEnvMgr(env: loadEnv())
    public private(set) var env:MAEnvModel?
    private init(env: MAEnvModel?) {
        self.env = env
    }
}
